<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateadminPermission extends Migrator
{
    public function up()
    {
        $table = $this->table('admin_permission', ['id' => 'id', 'comment' => '权限表', 'engine' => 'InnoDB', '']);
        $table->addColumn('permission_name', 'string', ['limit' => 60, 'default' => '', 'comment' => '权限名称'])
            ->addColumn('type', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '类型 1 菜单 2 接口'])
            ->addColumn('pid', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '父id'])
            ->addColumn('icon', 'string', ['limit' => 60, 'default' => '', 'comment' => '图标'])
            ->addColumn('component', 'string', ['limit' => 60, 'default' => '', 'comment' => '前端组件'])
            ->addColumn('describe', 'string', ['limit' => 100, 'default' => '', 'comment' => '描述'])
            ->addColumn('sort', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '排序'])
            ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态1正常 2 禁用'])
            ->addColumn('url', 'string', ['limit' => 60, 'default' => '', 'comment' => '接口地址'])

            ->addColumn("deleted_at","datetime",['null' => true,'comment'=>"删除时间"])
            ->addTimestamps('created_at','updated_at')
            ->create();
    }

    public function down()
    {
        $this->table('admin_permission')->drop();
    }
}
